using System.Collections.Generic;
using UnityEngine;

public class EventsDB : ScriptableObject
{
	private static EventsDB instance_;

	public List<Events.Tournament> tournaments = new List<Events.Tournament>();

	public List<Events.ExhibitionMatch> exhibitions = new List<Events.ExhibitionMatch>();

	public static EventsDB instance
	{
		get
		{
			if (instance_ == null)
			{
				instance_ = Resources.Load("TournamentsDefinitions/EventsDB", typeof(EventsDB)) as EventsDB;
			}
			return instance_;
		}
	}

	public Events.EventDefinition GetEventById(Events.EventDefinitionId eventId)
	{
		foreach (Events.Tournament tournament in tournaments)
		{
			if (tournament.eventId == eventId)
			{
				return tournament;
			}
		}
		foreach (Events.ExhibitionMatch exhibition in exhibitions)
		{
			if (exhibition.eventId == eventId)
			{
				return exhibition;
			}
		}
		return null;
	}
}
